The present invention relates to a method and a device for controlling processes in a vehicle, in particular for controlling a drive in a vehicle.
The address spaces of popular computers are divided into multiple segments of equal size, for example 64 kilobytes. While a program is running, it is possible to use an explicit command to switch from one code segment to the next following interrupt processing. For example, the individual functions of an engine controller are programmed as program parts, known as program sections, on pages 3-4 and 9-4 of the 80166 Cross-Assembler User""s Guide by Tasking Software B. V. These program parts are divided into consecutive sections for each interrupt or computing level. There is no jump instruction for switching from one section to the next. Therefore, the sectioned program parts are located in the same segment for the program code.
Based on the related art cited, different engine control functions can be implemented as subroutines, and these subroutines can be called in one or more sectioned program sequences. The actual comprehensive program code is thus located in an unspecified segment, and only the small subroutine calls need to fit into the code segment, i.e., program segment (of 64 kilobytes in size, for example) in which the remaining sectioned program parts of related engine controller control functions are located.
It has been found that the related art cited is unable to supply optimum results in every situation. Thus, even when using the subroutine calls, the latter and any additional sectioned program parts of related engine functions have to be arranged within the same code segment. In the case of powerful controllers, in particular those used to control processes in conjunction with an internal combustion engine, the code segment limit of 64 kilobytes, for example, is exceeded by various computing levels.
Even simply expanding existing functions by adding additional sections that contain program code, i.e., program parts, of recently added control functions quickly run up against or even exceed the existing code segment limit. As the central processing unit (CPU) uses 16-bit internal addressing, for example, it is not possible to expand the segments to any desired size, and thus increase the scope of the program code and control functions.
The object is therefore to link program code, i.e., program parts, belonging to related control functions, even if the latter exceed the maximum possible segment limit of 64 kilobytes, for example, when using 2 to the power of 16-bit addressability.
This problem naturally arises even in the case of larger and smaller code segments, such as when using 4, . . . , 8, . . . , 12, . . . , 16, . . . , 24, . . . , or 32-bit addressability.
The present invention describes a method and device for controlling processes in a vehicle, in particular for controlling a drive in a vehicle, using at least one processor, with the control functions being stored the form of program code in a processor-addressable address space in at least one memory; the address space being divided into segments of equal length; and the program code in program parts of each control function being stored in individual, consecutive sections in the segment. To allow related control functions, i.e., their program code, to exceed the maximum segment size, at least two segments are advantageously linked so that a section of a first segment contains an exit label, i.e., an exit instruction or an exit routine (i.e., program sequence) from the first segment, and a second section in the second segment contains an entry label, i.e., an entry instruction or an entry routine (i.e., program sequence), and the entry and exit labels are linked with each other in a way that provides a transition from the first segment to the second one. By bracketing at least two code segments in this manner, it is possible to use related control functions, i.e., their program code, of nearly any size beyond the segment limits.
The exit label is advantageously programmed in the last section of the first segment, and/or the entry label is programmed in the first section of the second segment. In the first segment, the program code thus grows from the end to the beginning of the segment, while in the second segment, it grows in the opposite direction from the beginning to the end of the segment. The sections containing program code are therefore sequenced in the segments in reverse order, depending on the control functions, i.e., program parts, stored in them, which doubles the available segment size when bracketing two segments. This method can also be used in a suitable manner for more than two code segments, i.e., program segments, and more than one interrupt/computing level. It is also unnecessary for the code segments in question to be arranged consecutively in the address space.
The segments do not necessarily have to be stored in the same memory area or the same memory. This segmentation has to do with processor addressability. This means that the processor addresses an address space that can include at least one physical memory, but also several different ones, thus defining its own separate virtual memory. Due to processor addressability, this address space, i.e., memory, is divided into segments of maximum size.
The entry label and the exit label each advantageously include a complete section in a single code segment, making it possible to easily append this section to existing sections or to easily start programming from these special sections (entry and/or exit labels) without having to take the labels (entry and/or exit labels) into consideration in the additional program code of the control functions.
All program parts or program code, i.e., the sections for the control functions, can thus be advantageously programmed and integrated using conventional software development methods without having to undergo any additional adaptation. This means that existing software modules do not have to be adapted, either. The latter can continue to be used for small systems, i.e., systems containing program code in one segment, as well as for large systems, i.e., systems that exceed the code segment limits.
Another advantage is that there is no need for iterative post-processing, such as inserting jumps and jump labels, compilation, assembly, testing, etc., of possibly two or more control functions per program version. Furthermore, iterative conversion of control functions to subroutines or the like, as in the related art, is suitably eliminated, which means there is no need for retesting or rechecking the program version.
All advantages of sectioning, as opposed to a pure subroutine method, can thus remain intact, such as modular programming and minimizing computing runtime and program storage space, which, in the end, lowers development and controller costs.
It is therefore possible to advantageously influence the distribution of program code to the code segments exclusively during software integration. It has no effect on the software module implementation process. This means that control function distribution can be defined in a controller task distribution system even before actual development, and it can also be advantageously expanded later on for a new program version.
When the expanded code segment limits are about to be exceeded, suitable linker/locator instructions can be used to ensure that unwanted limit overshooting does not inadvertently occur. In addition, adding another bracketed segment can directly avoid exceeding such limits.